﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace PingYou.Ado.Net
{
    public class Student
    {
        #region 新增学生数据
        public int AddStudent(StudentModel myModel)
        {
            string studentName = myModel.StudentName;
            int age = myModel.Age;
            try
            {
                SqlParameter[] param = new SqlParameter[] {
                    new SqlParameter("@StudentName",myModel.StudentName),
                    new SqlParameter("@Age",myModel.Age),
                };
                string sql = " insert into student (StudentName,Age,Enabled)  ";
                sql += $"values('{studentName}',{age},{1})";
                return SQLHelper.ExacuteNoQuery(sql,param);
            }
            catch (Exception myEx)
            {
                throw myEx;
            }
        }
        #endregion
    }

    public class StudentModel
    {
        public string StudentName { get; set; }
        public int Age { get; set; }
        public string Remark { get; set; }
        public int Gender { get; set; }
    }
}
